package b.p.b;

import android.view.View;

/* compiled from: ViewBoundsCheck */
public class g0 {
    public final b a;
    public a b = new a();

    /* compiled from: ViewBoundsCheck */
    public static class a {
        public int a = 0;
        public int b;
        public int c;
        public int d;
        public int e;

        public boolean a() {
            int i = this.a;
            if ((i & 7) != 0 && (i & (b(this.d, this.b) << 0)) == 0) {
                return false;
            }
            i = this.a;
            if ((i & 112) != 0 && (i & (b(this.d, this.c) << 4)) == 0) {
                return false;
            }
            i = this.a;
            if ((i & 1792) != 0 && (i & (b(this.e, this.b) << 8)) == 0) {
                return false;
            }
            i = this.a;
            if ((i & 28672) == 0 || (i & (b(this.e, this.c) << 12)) != 0) {
                return true;
            }
            return false;
        }

        public int b(int i, int i2) {
            return i > i2 ? 1 : i == i2 ? 2 : 4;
        }
    }

    /* compiled from: ViewBoundsCheck */
    public interface b {
        int a();

        int b(View view);

        View c(int i);

        int d();

        int e(View view);
    }

    public g0(b bVar) {
        this.a = bVar;
    }

    public View a(int i, int i2, int i3, int i4) {
        int d = this.a.d();
        int a = this.a.a();
        int i5 = i2 > i ? 1 : -1;
        View view = null;
        while (i != i2) {
            View c = this.a.c(i);
            int b = this.a.b(c);
            int e = this.a.e(c);
            a aVar = this.b;
            aVar.b = d;
            aVar.c = a;
            aVar.d = b;
            aVar.e = e;
            if (i3 != 0) {
                aVar.a = 0;
                aVar.a = i3 | 0;
                if (aVar.a()) {
                    return c;
                }
            }
            if (i4 != 0) {
                a aVar2 = this.b;
                aVar2.a = 0;
                aVar2.a = i4 | 0;
                if (aVar2.a()) {
                    view = c;
                }
            }
            i += i5;
        }
        return view;
    }

    public boolean b(View view, int i) {
        a aVar = this.b;
        int d = this.a.d();
        int a = this.a.a();
        int b = this.a.b(view);
        int e = this.a.e(view);
        aVar.b = d;
        aVar.c = a;
        aVar.d = b;
        aVar.e = e;
        if (i == 0) {
            return false;
        }
        aVar = this.b;
        aVar.a = 0;
        aVar.a = 0 | i;
        return aVar.a();
    }
}
